import request from '@/utils/request'

const api = {
  user: '/user',
  service: '/service',
  device: '/device',
  permission: '/permission',
  permissionNoPager: '/permission/no-pager',
  orgTree: '/org/tree'
}

export default api

// 首页获取数据
export function getHomeData (parameter) {
  return request({
    url: '/iot/home/data',
    method: 'get',
    data: parameter
  })
}
export function createDeviceSetting (parameter) {
  return request({
    url: '/iot/iotAlarmParamPushRecord/create',
    method: 'post',
    data: parameter
  })
}
//

// 设备列表
export function getDeviceList (parameter) {
  return request({
    url: '/iot_alarms/iotAlarms/list',
    method: 'get',
    params: parameter
  })
}
// 添加设备
export function createDevice (parameter) {
  return request({
    url: '/iot_alarms/iotAlarms/create',
    method: 'post',
    data: parameter
  })
}
// 添加设备
export function createDeviceNew (parameter) {
  return request({
    url: '/iot/iotAlarmParamPushRecord/create',
    method: 'post',
    data: parameter
  })
}
// 添加设备
export function createDevicePushAll (parameter) {
  return request({
    url: '/iot/iotAlarmParamPushRecord/pushAll',
    method: 'post',
    data: parameter
  })
}
// 获取设备详情
export function detailDevice (id) {
  return request({
    url: '/iot_alarms/iotAlarms/' + id,
    method: 'get'
  })
}
// 修改设备
export function updateDevice (parameter) {
  return request({
    url: '/iot_alarms/iotAlarms/update',
    method: 'post',
    data: parameter
  })
}
// 删除设备
export function deleteDevice (id) {
  return request({
    url: '/iot_alarms/iotAlarms/delete/' + id,
    method: 'post',
    data: {

    }
  })
}

// 获取设备
export function GetDevice (id) {
  return request({
    url: '/iot_alarms/iotAlarms/' + id,
    method: 'get',
    data: {

    }
  })
}

///iot/iotAlarmParamPushRecord/create

export function getIotAlarmsList (parameter) {
  return request({
    url: '/iot_alarms/iotAlarms/list',
    method: 'get',
    params: parameter
  })
}

// 设备分组列表
export function getDeviceGroupList (parameter) {
  return request({
    url: '/iot/iotGroup/list',
    method: 'get',
    params: parameter
  })
}
// 曲线分析
export function getDeviceCurveStat (parameter) {
  return request({
    url: '/iot/alarmDataStat/curveStat',
    method: 'get',
    params: parameter
  })
}
// 添加设备分组
export function createDeviceGroup (parameter) {
  return request({
    url: '/iot/iotGroup/create',
    method: 'post',
    data: parameter
  })
}
// 修改设备
export function updateDeviceGroup (parameter) {
  return request({
    url: '/iot/iotGroup/update',
    method: 'post',
    data: parameter
  })
}
// 删除设备
export function deleteDeviceGroup (id) {
  return request({
    url: '/iot/iotGroup/delete/' + id,
    method: 'post',
    data: {

    }
  })
}
// 设备历史数据
export function getHistoryList (parameter) {
  return request({
    url: '/iot/monitorRecord/list',
    method: 'get',
    params: parameter
  })
}
// 设备最新数据
export function getAlarmData (parameter) {
  return request({
    url: '/iot/alarmDataRecordNew/getAlarmData',
    method: 'get',
    params: parameter
  })
}

// 节能减排统计
export function getDataStat (parameter) {
  return request({
    url: '/iot/alarmDataStat/stat',
    method: 'get',
    params: parameter
  })
}

